package org.hairball.analysis;

import org.objectweb.asm.tree.ClassNode;

import java.util.HashSet;
import java.util.Set;

public class CompositeClassAnalyser implements RelationshipAnalyser {
    private RelationshipAnalyser[] analysers;

    public CompositeClassAnalyser(RelationshipAnalyser... analysers) {
        this.analysers = analysers;
    }

    public Set<Relationship> analyse(ClassNode node) {
        Set<Relationship> relationships = new HashSet<Relationship>();

        for (RelationshipAnalyser analyser : analysers) {
            relationships.addAll(analyser.analyse(node));
        }
        return relationships;
    }
}
